﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using LogWare.ViewModel;

namespace LogWare.Model {

	public class OrderDetailVM : EditableBaseViewModel {
		private int _quantity;
		private string _product;
		private decimal _price;
		private int _vat;
		private decimal _linePrice;

		[DisplayName("Προϊόν")]
		[State]
		public string Product {
			get { return _product; }
			set {
				_product = value;
				RaisePropertyChanged("Product");
			}
		}

		[DisplayName("Ποσότητα")]
		[State]
		public int Quantity {
			get { return _quantity; }
			set { 
				_quantity = value;
				_linePrice = _price * (1+ _vat * 0.01m) * _quantity;
				RaisePropertyChanged("Quantity");
				RaisePropertyChanged("LinePrice");
			}
		}

		[DisplayName("Τιμή Μονάδας")]
		[State]
		public decimal Price {
			get { return _price; }
			set {
				_price = value;
				_linePrice = _price*(1 + _vat*0.01m)*_quantity;
				RaisePropertyChanged("Price");
				RaisePropertyChanged("LinePrice");
			}
		}

		[DisplayName("Φ.Π.Α.")]
		[State]
		[DefaultValue(23)]
		public int Vat {
			get { return _vat; }
			set {
				_vat = value;
				_linePrice = _price * (1 + _vat * 0.01m) * _quantity;
				RaisePropertyChanged("Vat");
				RaisePropertyChanged("LinePrice");
			}
		}

		[DisplayName("Συνολική Τιμή")]
		public decimal LinePrice {
			get { return _linePrice; }
			set {
				_linePrice = value;
				RaisePropertyChanged("LinePrice");
			}
		}
	}
}
